package com.weiyuwqj.server.mapper;

import com.weiyuwqj.api.model.BasDebt;
import com.weiyuwqj.api.model.vo.BasDebtVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Repository
public interface BasDebtMapper extends Mapper<BasDebt> {

    /**
     * 查询债权列表
     * @param map
     * @return
     */
    List<BasDebtVO> getDebtList(Map map);

    /**
     * 根据债权id查询债权对象
     * @param debtId
     * @return
     */
    BasDebtVO getDebtById(Integer debtId);

    /**
     * 更新债权状态
     * @param oldStatus
     * @param newStatus
     * @param debtId
     * @return
     */
    int updateDebtStatus(@Param("oldStatus")int oldStatus, @Param("newStatus")int newStatus,@Param("debtId")Integer debtId);

    //更新债权进度和金额
    int updateAmountAndScale(@Param("amount")BigDecimal amount,
                             @Param("onGoingAmount")BigDecimal onGoingAmount,
                             @Param("debtScale")BigDecimal debtScale,
                             @Param("debtId")Integer debtId);


    int updateFullTime(Map map);

    /**
     * 根据id修改状态
     * @param newStatus
     * @param oldStatus
     * @param id
     * @return
     */
    Integer modifyDebtStatusById(@Param("newStatus")Integer newStatus,@Param("oldStatus")Integer oldStatus,@Param("id")Integer id);

    /**
     * 根据投资id查询债权信息
     * @param investId
     * @param debtInvestId
     * @return
     */
    BasDebt getDebtByInvestIdOrDebtInvestId(@Param("investId")Integer investId,@Param("debtInvestId")Integer debtInvestId);

}